<!-- <template>
    <div id="IndexPage">
    <el-container style="height: 800px; border: 1px solid #eee">
    
  <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
    <el-header style="border-radius: 8px 0px 0px 0px;background-color: #2b334a;">
        <div class="header"><span style="color: white;margin-left: -20px;">校园管理系统</span></div>
      </el-header>
    <el-menu :default-openeds="['1', '4']">
      <el-menu-item index="1"><i class="el-icon-message"></i>首页</el-menu-item>
      <el-submenu index="1">
        <template slot="title"><i class="el-icon-edit-outline"></i>日常办公</template>
          <el-menu-item index="1-1">待审批申请</el-menu-item>
          <el-submenu index="1-2">
          <template slot="title">我的代办</template>
          <el-menu-item index="1-2-1">请假申请审批</el-menu-item>
          <el-menu-item index="1-2-2">离职申请审批</el-menu-item>
          <el-menu-item index="1-2-3">教材领用申请审批</el-menu-item>
          <el-menu-item index="1-2-4">物品申请审批</el-menu-item>
        </el-submenu>
        <el-menu-item-group title="分组2">
          <el-menu-item index="1-3">选项3</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="1-4">
          <template slot="title">选项4</template>
          <el-menu-item index="1-4-1">选项4-1</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title"><i class="el-icon-upload"></i>大华管理</template>
        <el-menu-item-group>
          <template slot="title">分组一</template>
          <el-menu-item index="2-1">选项1</el-menu-item>
          <el-menu-item index="2-2">选项2</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="分组2">
          <el-menu-item index="2-3">选项3</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="2-4">
          <template slot="title">选项4</template>
          <el-menu-item index="2-4-1">选项4-1</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title"><i class="el-icon-setting"></i>迎新管理</template>
        <el-menu-item-group>
          <template slot="title">分组一</template>
          <el-menu-item index="3-1">选项1</el-menu-item>
          <el-menu-item index="3-2">选项2</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="分组2">
          <el-menu-item index="3-3">选项3</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="3-4">
          <template slot="title">选项4</template>
          <el-menu-item index="3-4-1">选项4-1</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-submenu index="4">
        <template slot="title"><i class="el-icon-setting"></i>基础数据</template>
          <el-menu-item index="4-1"><router-link to="/App"><i class="el-icon-setting"></i>科目管理</router-link></el-menu-item>
          <el-menu-item index="4-2">学校信息管理</el-menu-item>
          <el-menu-item index="4-3">专业类别管理</el-menu-item>
          <el-menu-item index="4-4"><i class="el-icon-setting"></i>专业管理</el-menu-item>
          <el-menu-item index="4-4"><i class="el-icon-setting"></i>学年学期管理</el-menu-item>
          <el-menu-item index="4-3">校园管理</el-menu-item>
          <el-menu-item index="4-4"><i class="el-icon-setting"></i>班级信息维护</el-menu-item>
          <el-menu-item index="4-4"><i class="el-icon-setting"></i>节次设置</el-menu-item>
          <el-menu-item index="4-4"><i class="el-icon-setting"></i>设备管理</el-menu-item>
        </el-submenu>
    </el-menu>
  </el-aside>
  
  <el-container>

    <el-header style="text-align: right; font-size: 12px;border-radius: 0px 8px 0px 0px;">
      <i class="el-icon-s-fold" style="margin-right:1300px;font-size: 25px;margin-top: 15px;"></i>
      <span>{{userName}}</span>

      <el-dropdown>
        <i class="el-icon-arrow-down" style="margin-right: 30px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item @click.native="loginout">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </el-header>
    
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</el-container>
</div>
</template>
<script>
import axios from 'axios';
export default {
    name: 'IndexPage',
    data(){
      return{
        Authorization:{
          
        },
        userName:'',
      }
    },
    created () {
      this.getInfo();
    },
    methods: {
      getInfo(){
        this.Authorization = localStorage.getItem("Authorization");
        if(this.Authorization == null || this.Authorization == ''){
          this.$router.push('/login');
        }else{
          this.getRouters();
          axios({
            url: 'http://localhost:9002/admin/info',
            method: 'get',
            headers: {
              'Authorization': this.Authorization
            }
          })
          .then(response => {
            console.log(response);
            this.userName = response.data.data.name;
            
          })
        }
      },
      loginout(){
        console.log("退出登录");
        if(confirm("确定退出登录？")){
            axios({
              url: 'http://localhost:9002/admin/logout',
              method: 'post',
            })
            .then(response => {
              console.log(response);
              localStorage.removeItem("Authorization");
              this.$router.push('/login');
            })
        }
        
      },
      getRouters(){
        axios({
          url: 'http://localhost:9002/sys/menu/getRouters',
          method: 'get',
          headers: {
              'Authorization': this.Authorization
          }
        })
        .then(response => {
          console.log(response.data.data);
          
        })
      }
    }
}
</script>
<style>
 .el-header {
    background-color: white;
    border-bottom: 1px solid gray;
    color: #333;
    line-height: 60px;
  }
  
  .el-aside {
    color: #333;
  }
  /* .header{
    background-color: black;
    width:198px;
    border: 1px solid black;
    position: absolute;
    left: 9px;
    border-radius: 8px 0px 0px 0px;
    z-index: 9999;
  } */
  .header span {
    color: white;
    position: relative;
    left: 40px;
  }
</style> -->